package com.flycent.fanbao.ui;

import java.lang.ref.WeakReference;

import com.flycent.fanbao.App;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;

/**
 * @author fbl
 *  线程activity
 */ 
public class HandlerActivity extends BackableTitleBarActivity{

	private Handler mHandler = new MyHandler(this);

	@Override
	protected void onCreate(Bundle savedInstance) {
		super.onCreate(savedInstance);

		mHandler.sendEmptyMessage(1);
	}


	@SuppressLint("HandlerLeak") 
	private  class MyHandler extends Handler{

		private final WeakReference<Activity> mActivity;

		public MyHandler(Activity activity) {  
			mActivity = new WeakReference<Activity>(activity);  
		}  

		@Override
		public void handleMessage(Message msg) {
			super.handleMessage(msg);

			if( mActivity.get() != null ){
				switch (msg.what) {
				case 1:
					App.showShortToast("handler");
					break;

				default:
					break;
				}

			}else {
				return;
			}

		}

	}

}
